home *** CD-ROM | disk | FTP | other *** search
/ Minami 78 / MINAMI78.iso / Extra / winamp53.exe / $R0 / Winamp Modern / scripts / display.m < prev    next >
Text File  |  2005-09-15  |  2KB  |  85 lines

  1. #include <lib/std.mi>
  2. #include "attribs.m"
  3.  
  4. Global Group frameGroup;
  5. Global Togglebutton ShuffleBtn,RepeatBtn,ShuffleBtn2,RepeatBtn2;
  6. Global Timer SongTickerTimer;
  7. Global Text SongTicker;
  8. Global Slider Balance;
  9.  
  10. function setSongtickerScrolling();
  11.  
  12. System.onScriptLoaded() {
  13.     initAttribs();
  14.     frameGroup = getScriptGroup();
  15.     SongTicker = frameGroup.findObject("songticker");
  16.     SongTickerTimer = new Timer;
  17.     SongTickerTimer.setDelay(1000);
  18.  
  19.     RepeatBtn = frameGroup.findObject("Repeat");
  20.     ShuffleBtn = frameGroup.findObject("Shuffle");
  21.     RepeatBtn2 = frameGroup.findObject("RepeatDisplay");
  22.     ShuffleBtn2 = frameGroup.findObject("ShuffleDisplay");
  23.  
  24.     Balance = frameGroup.findObject("Balance");
  25.     setSongtickerScrolling();
  26. }
  27.  
  28.  
  29. Balance.onSetPosition(int newpos) {
  30.         string t="Balance:";
  31.         if (newpos==127) t+="Center";
  32.         if (newpos<127) t+="Left " + integerToString(100-(newpos/127)*100)+"%";
  33.         if (newpos>127) t+="Right " + integerToString(((newpos-127)/127)*100)+"%";
  34.  
  35.         SongTickerTimer.start();
  36.         SongTicker.setText(t);
  37. }
  38.  
  39. SongTickerTimer.onTimer() {
  40.     SongTicker.setText("");
  41.     SongTickerTimer.stop();
  42. }
  43.  
  44. System.onScriptUnloading() {
  45.     delete SongTickerTimer;
  46. }
  47.  
  48. RepeatBtn.onToggle(boolean on) {
  49.         SongTickerTimer.start();
  50.         int v = getCurCfgVal();
  51.         if (v == 0) SongTicker.setText("Repeat: OFF");
  52.                 else if (v > 0) SongTicker.setText("Repeat: ALL");
  53.                 else if (v < 0) SongTicker.setText("Repeat: TRACK");
  54. }
  55.  
  56. ShuffleBtn.onToggle(boolean on) {
  57.         SongTickerTimer.start();
  58.         if (on) SongTicker.setText("Playlist Shuffling: ON"); else SongTicker.setText("Playlist Shuffling: OFF");
  59. }
  60.  
  61. RepeatBtn2.onToggle(boolean on) {
  62.         SongTickerTimer.start();
  63.         int v = getCurCfgVal();
  64.         if (v == 0) SongTicker.setText("Repeat: OFF");
  65.                 else if (v > 0) SongTicker.setText("Repeat: ALL");
  66.                 else if (v < 0) SongTicker.setText("Repeat: TRACK");
  67. }
  68.  
  69. ShuffleBtn2.onToggle(boolean on) {
  70.         SongTickerTimer.start();
  71.         if (on) SongTicker.setText("Playlist Shuffling: ON"); else SongTicker.setText("Playlist Shuffling: OFF");
  72. }
  73.  
  74. songticker_scrolling_enabled_attrib.onDataChanged() {
  75.     setSongtickerScrolling();
  76. }
  77.  
  78. setSongtickerScrolling() {
  79.     if (songticker_scrolling_enabled_attrib.getData()=="1") {
  80.         SongTicker.setXMLParam("ticker","1");
  81.     } else {
  82.         SongTicker.setXMLParam("ticker","0");
  83.     }
  84. }
  85.